<div id="steps" class="form complex">
<?php
//echo form_open('peserta/peserta/insert_peserta');
?>

<script>
function konfirm()
	{
		confirm("Selamat, Registarsi Telah Berhasil Dilakukan.");
	}
</script>

<?
    //Setting Value Jika Prosedur yang dilakukan adalah prosedur input biasa.
	$value = array(
		'status_dropdown'			=> "",
		'status_field'			=> "",
		'id_peserta'			=> "",
		'nama_peserta'					=> "",
		'nama_panggilan'				=> "",
		'jenis_kelamin'					=> "",
		'alamat'					=> "",
		'kode_pos'				=> "",
		'kota'					=> "",
		'tempat_lahir'					=> "",
		'tanggal'					=> "",
		'bulan'					=> "",
		'tahun'					=> "",
		'no_hp'					=> "",
		'email'					=> "",
		'twitter'					=> "",
		'no_darurat'					=> "",
		'hub_darurat'					=> "",
		'pekerjaan'					=> "",
		'nama_usaha'					=> "",
		'jenis_usaha'					=> "",
		'omset'					=> "",
		'ukuran_baju'					=> "",
		'referensi'					=> "",
		'promo'					=> "",
		'informasi'					=> "",
		'id_batch'					=> "",
		'tanggal_pembayaran'					=> "",
		'no_transfer'			=> "",
		'act_form'				=> "peserta/peserta/insert_peserta/"
	);
	
	
	//Setting Value pada form Jika melakukan prosedur Edit terhadap data tertentu.
	if($status == "preview"){
		
			$value['status_dropdown'] = 'disabled="disabled"';
			$value['status_field'] = 'READONLY';
			$value['id_peserta'] = $id_peserta;
			$value['nama_peserta'] = $nama_peserta;
			$value['nama_panggilan'] = $nama_panggilan;
			$value['jenis_kelamin'] = $jenis_kelamin;
			$value['alamat'] = $alamat;
			$value['kode_pos'] = $kode_pos;
			$value['kota'] = $kota;
			$value['tempat_lahir'] = $tempat_lahir;
			$value['tanggal'] = $tanggal;
			$value['bulan'] = $bulan;
			$value['tahun'] = $tahun;
			$value['no_hp'] = $no_hp;
			$value['email'] = $email;
			$value['twitter'] = $twitter;
			$value['no_darurat'] = $no_darurat;
			$value['hub_darurat'] = $hub_darurat;
			$value['pekerjaan'] = $pekerjaan;
			$value['nama_usaha'] = $nama_usaha;
			$value['jenis_usaha'] = $jenis_usaha;
			$value['omset'] = $omset;
			$value['ukuran_baju'] = $ukuran_baju;
			$value['referensi'] = $referensi;
			$value['promo'] = $promo;
			$value['informasi'] = $informasi;
			$value['tanggal_pembayaran'] = $tanggal_pembayaran;
			$value['no_transfer'] = $no_transfer;
			$value['id_batch'] = $id_batch;
			
			//$value['act_form'] = "peserta/peserta/update_peserta/".$value['id_peserta'];
	}//end if
	
	
	//Setting Value pada form Jika melakukan prosedur Edit terhadap data tertentu.
	else if($status == "edit"){
			$value['status_dropdown'] = '';
			$value['status_field'] = '';
			$value['id_peserta'] = $id_peserta;
			$value['nama_peserta'] = $nama_peserta;
			$value['nama_panggilan'] = $nama_panggilan;
			$value['jenis_kelamin'] = $jenis_kelamin;
			$value['alamat'] = $alamat;
			$value['kode_pos'] = $kode_pos;
			$value['kota'] = $kota;
			$value['tempat_lahir'] = $tempat_lahir;
			$value['tanggal'] = $tanggal;
			$value['bulan'] = $bulan;
			$value['tahun'] = $tahun;
			$value['no_hp'] = $no_hp;
			$value['email'] = $email;
			$value['twitter'] = $twitter;
			$value['no_darurat'] = $no_darurat;
			$value['hub_darurat'] = $hub_darurat;
			$value['pekerjaan'] = $pekerjaan;
			$value['nama_usaha'] = $nama_usaha;
			$value['jenis_usaha'] = $jenis_usaha;
			$value['omset'] = $omset;
			$value['ukuran_baju'] = $ukuran_baju;
			$value['referensi'] = $referensi;
			$value['promo'] = $promo;
			$value['informasi'] = $informasi;
			$value['tanggal_pembayaran'] = $tanggal_pembayaran;
			$value['no_transfer'] = $no_transfer;
			$value['id_batch'] = $id_batch;
			
			$value['act_form'] = "peserta/peserta/update_peserta/".$value['id_peserta'];
	}//end if
?>
<?= form_open($value["act_form"]); ?>

	<form>
		<fieldset class="step">
		
			<p>
				<label>Nama Lengkap</label>
				<input <?=$value['status_field']?> id="" name="nama_peserta" type="text" value="<?=$value['nama_peserta']?>" tabindex="1" />
			</p>
			
			<p>
				<label>Nama Panggilan</label>
				<input <?=$value['status_field']?> id="nama" name="nama_panggilan" type="text" value="<?=$value['nama_panggilan']?>" tabindex="1" />
			</p>
			<p>
				<label>Jenis Kelamin</label>
				<? 
				//list jenis kelamin
				$options['0'] = "-- Pilih Jenis Kelamin --";
				$options['L'] = "Laki-laki";
				$options['P'] = "Perempuan";
				echo form_dropdown('jenis_kelamin',$options,$value["jenis_kelamin"],$value["status_dropdown"],'class="field select"');	
				?>
			</p>
			
			<p>
				<label>Alamat Rumah</label>
				<textarea <?=$value['status_field']?> id="element_2" name="alamat" ><?=$value['alamat']?></textarea> 
			</p>
			<p>
				<label>Kode Pos</label>
				<input <?=$value['status_field']?> id="nama" name="kode_pos" type="text" value="<?=$value['kode_pos']?>" tabindex="1" /> 
			</p>
			<p>
				<label>Kota*</label>
				<input <?=$value['status_field']?> id="nama" name="kota" type="text" value="<?=$value['kota']?>" tabindex="1" />
			</p>
			
			<p>
				<label>Tempat Lahir</label>
				<input <?=$value['status_field']?> id="nama" name="tempat_lahir" type="text" value="<?=$value['tempat_lahir']?>" tabindex="1" />
			</p>
			<p>	
				<label>Tanggal Lahir</label>
				<input <?=$value['status_field']?> style="width: 30px;margin-right:5px;" id="element_4_2" name="tgl" size="2" maxlength="2" value="<?=$value['tanggal']?>" type="text">
				<input <?=$value['status_field']?> style="width:30px;margin-right:5px;" id="element_4_1" name="bln" size="2" maxlength="2" value="<?=$value['bulan']?>" type="text">
				<input <?=$value['status_field']?> style="width: 80px;" id="element_4_3" name="thn" size="4" maxlength="4" value="<?=$value['tahun']?>" type="text">

				<img id="cal_img_4" src="<?=base_url();?>images/form/calendar.gif" alt="Pick a date.">	
				<? if ($status != 'preview')
				{
					echo'
					<script type="text/javascript">
						Calendar.setup({
						inputField	 : "element_4_3",
						baseField    : "element_4",
						displayArea  : "calendar_4",
						button		 : "cal_img_4",
						ifFormat	 : "%B %e, %Y",
						onSelect	 : selectDate
						});					
					</script>
					';
				}
				?>
				
			</p>
			
			<p>
				<label>No Telepon/Handphone</label>
				<input <?=$value['status_field']?> id="nama" name="no_hp" type="text" value="<?=$value['no_hp']?>" tabindex="1" />
			</p>
			<p>
				<label>Alamat Email*</label>
				<input <?=$value['status_field']?> id="nama" name="email" type="text" value="<?=$value['email']?>" tabindex="1" />
			</p>
			<p>
				<label>Twitter Account (ID Twitter Anda. ex : @ECampIndonesia. Kosongkan jika belum punya.</label>
				<input <?=$value['status_field']?> id="nama" name="twitter" type="text" value="<?=$value['twitter']?>" tabindex="1" />
			</p>
			
			<p>
				<label>No Telepon Darurat*</label>
				<input <?=$value['status_field']?> id="nama" name="no_darurat" type="text" value="<?=$value['no_darurat']?>" tabindex="1" />
			</p>
			<p>
				<label>Hubungan * Apa hubungan Anda dengan Pemilik Nomor Telepon Darurat</label>
				<? 
				//list pekerjaan
				unset($options);
				//$options['0'] = "-- Pilih Satu --";
				$options['Istri/Suami'] = "Istri/Suami";
				$options['Kakak'] = "Kakak";
				$options['Adik'] = "Adik";
				$options['Orang Tua'] = "Orang Tua";
				$options['Yang Lain'] = "Yang Lain";
				echo form_dropdown('hub_darurat',$options,$value["pekerjaan"],$value["status_dropdown"],'class="field select"');	
				?>
			</p>
			<p>
				<label>Pekerjaan</label>
				<? 
				//list pekerjaan
				unset($options);
				//$options['0'] = "-- Pilih pekerjaan --";
				$options['Pelajar/Mahasiswa'] = "Pelajar/Mahasiswa";
				$options['Karyawan Swasta'] = "Karyawan Swasta";
				$options['Wiraswasta'] = "Wiraswasta";
				$options['Pegawai Negeri/BUMN'] = "Pegawai Negeri/BUMN";
				$options['Yang Lain'] = "Yang Lain";
				echo form_dropdown('pekerjaan',$options,$value["pekerjaan"],$value["status_dropdown"],'class="field select"');	
				?>
			</p>
			<p>
				<label>Nama Usaha</label>
				<input <?=$value['status_field']?> id="nama" name="nama_usaha" type="text" value="<?=$value['nama_usaha']?>" tabindex="1" />
			</p>
			<p>
				<label>Jenis Usaha</label>
				<input <?=$value['status_field']?> id="nama" name="jenis_usaha" type="text" value="<?=$value['jenis_usaha']?>" tabindex="1" />
			</p>
			<p>
				<label>Omset Sekarang</label>
				<input <?=$value['status_field']?> id="nama" name="omset" type="text" value="<?=$value['omset']?>" tabindex="1" />
			</p>
			
			<p>
				<label>Angkatan/Batch</label>
				<?
				unset($options);				
				//list jenis kelamin
				//$options['0'] = "-- Pilih Jenis Kelamin --";
				//$options['0'] = "-- Pilih Tahun Anggaran --";
				foreach ($batch->result() as $row){
					$options[$row->ID_BATCH] = $row->NAMA_BATCH;
				}
				
				//$options['1'] = "Batch 10";
				//$options['2'] = "Batch 11";
				echo form_dropdown('batch',$options,$value["id_batch"],$value["status_dropdown"],'class="field select"');	
				?>	
				
			</p>
			
			
			
			<p>
				<label>Ukuran T-Shirt*</label>
				<? 
				//list ukuran baju
					unset($options);
					//$options['0'] = "-- Pilih Ukuran Baju --";
					$options['S'] = "S";
					$options['M'] = "M";
					$options['L'] = "L";
					$options['XL'] = "XL";
					$options['XXL'] = "XXL";
					$options['XXXL'] = "XXXL";
					
					echo form_dropdown('ukuran_baju',$options,$value["ukuran_baju"],$value["status_dropdown"],'class="field select"');	
				?>
				
			</p>
			
			
			<p>
				<label>Referensi*</label>
				<? 
				//list ukuran baju
					unset($options);
					//$options['0'] = "-- Pilih Ukuran Baju --";
					$options['Majalah'] = "Majalah";
					$options['Surat Kabar'] = "Surat Kabar";
					$options['Website'] = "Website";
					$options['Twitter @ECampIndonesia'] = "Twitter @ECampIndonesia";
					$options['Yang Lain'] = "Yang Lain";
					
					echo form_dropdown('referensi',$options,$value["referensi"],$value["status_dropdown"],'class="field select"');	
				?>
				
			</p>
			<p>
				<label>Saya ingin mendapatkan PEGASUS - PROMO ECAMP HARGA KHUSUS.</label>
				<? 
				//list ukuran baju
					unset($options);
					//$options['0'] = "-- Pilih Ukuran Baju --";
					$options['1'] = "Ya";
					$options['0'] = "Tidak";
					
					echo form_dropdown('promo',$options,$value["promo"],$value["status_dropdown"],'class="field select"');	
				?>
			</p>
			<p>
				<label>Saya ingin mendapatkan informasi seputar Ecamp.</label>
				<? 
				//list ukuran baju
					unset($options);
					//$options['0'] = "-- Pilih Ukuran Baju --";
					$options['1'] = "Ya";
					$options['0'] = "Tidak";
					
					echo form_dropdown('informasi',$options,$value["informasi"],$value["status_dropdown"],'class="field select"');	
				?>
			</p>
			
			<p>
				<label>No Pembayaran/Transfer</label>
				<input <?=$value['status_field']?> id="nama" name="no_transfer" type="text" value="<?=$value['no_transfer']?>" tabindex="1" />
			</p>
			<p>	
				<label>Tanggal Pembayaran/Transfer</label>
				<input <?=$value['status_field']?> style="width: 30px;margin-right:5px;" id="element_4_2" name="tgl" size="2" maxlength="2" value="<?=$value['tanggal']?>" type="text">
				<input <?=$value['status_field']?> style="width:30px;margin-right:5px;" id="element_4_1" name="bln" size="2" maxlength="2" value="<?=$value['bulan']?>" type="text">
				<input <?=$value['status_field']?> style="width: 80px;" id="element_4_3" name="thn" size="4" maxlength="4" value="<?=$value['tahun']?>" type="text">

				<img id="cal_img_4" src="<?=base_url();?>images/form/calendar.gif" alt="Pick a date.">	
				<? if ($status != 'preview')
				{
					echo'
					<script type="text/javascript">
						Calendar.setup({
						inputField	 : "element_4_3",
						baseField    : "element_4",
						displayArea  : "calendar_4",
						button		 : "cal_img_4",
						ifFormat	 : "%B %e, %Y",
						onSelect	 : selectDate
						});					
					</script>
					';
				}
				?>
				
			</p>
			
			<!-- Start Tombol -->
			<? if ($status == 'preview')
			{
				$id_batch = $this->session->userdata('id_batch');
				$id_peserta = $value['id_peserta'];
				echo '
				<p>
					<a href=\''.base_url().'index.php/peserta/peserta/edit/'.$id_peserta.'\'>Update data peserta</a>
				</p>
				<p>
					<a href=\''.base_url().'index.php/peserta/peserta_lulus/daftar/'.$id_batch.'\'>Kembali ke daftar peserta lulus</a>
				</p>
				';
			}
			else
			{
				echo '
				<p class="submit">
				<button id="registerButton" type="submit" onclick="konfirm();">Simpan</button>&nbsp;
				<button id="registerButton" type="reset">Reset</button>&nbsp;
				<button id="registerButton" type="submit">Kembali</button>
				</p >
				';
			}
			?>

		</fieldset>
	</form> 
<?php
echo form_close();
?>
</div>